#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //初始化lineedit
    ui->lineEdit_name->setPlaceholderText("请输入你的名字");
    ui->lineEdit_name->setClearButtonEnabled(true);

    ui->lineEdit_password->setPlaceholderText("请输入密码");
    ui->lineEdit_password->setClearButtonEnabled(true);
    //这里密码需要使用特殊的方式显示
    ui->lineEdit_password->setEchoMode(QLineEdit::Password);

    ui->lineEdit_tele->setPlaceholderText("请输入你的电话");
    ui->lineEdit_tele->setClearButtonEnabled(true);
    ui->lineEdit_tele->setInputMask("000-0000-0000");  //这里对电话号的位数进行了一定的限制
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    //当确认提交以后就可以打印出来，后序也可以通过网络的方式进行提交等
    qDebug() << "姓名: " << ui->lineEdit_name->text() << "密码: " << ui->lineEdit_password->text()
             << "电话: " << ui->lineEdit_tele->text();
}
